{template '_header'}
<style type='text/css'>
    .trhead td {  background:#efefef;text-align: center}
    .trbody td {  text-align: center; vertical-align:top;border-left:1px solid #f2f2f2;overflow: hidden; font-size:12px;}
    .trorder { background:#f8f8f8;border:1px solid #f2f2f2;text-align:left;}
    .ops { border-right:1px solid #f2f2f2; text-align: center;}
    .ops a,.ops span{
        margin: 3px 0;
    }
    .table-top .op:hover{
        color: #000;
    }
    .tables{
        border:1px solid #e5e5e5;
        font-size: 12px;
        line-height: 18px;
    }
    .tables:hover{
        border:1px solid #b1d8f5;
    }
    .table-row,.table-header,.table-footer,.table-top{
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        justify-content: center;
        -webkit-justify-content: center;
        -webkit-align-content: space-around;
        align-content: space-around;
    }
    .tables  .table-row>div{
        padding: 14px 0 !important;
    }
    .tables  .table-row>div.columnFlex{
        padding: 0 !important;
    }
    .tables  .table-row.table-top>div{
        margin: 0 !important;
        padding: 16px 0;
    }
    .tables    .table-row .ops.list-inner{
        border-right:none;
    }
    .tables .list-inner{
       border-right: 1px solid #efefef;
        vertical-align: middle;
    }
    .table-row .goods-des .title{
        width:180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .table-row .goods-des{
        width:300px;
        border-right: 1px solid #efefef;
        vertical-align: middle;
    }
    .table-row .goods-des.singleRefund{
        padding: 0px !important;
        display: flex;
        flex-direction: column;
        margin: 0 !important;
    }
    .table-row .goods-des.singleRefund{
        padding: 16px 0;

    }
    .table-row .goods-des.singleRefund .goodsRefund{
        border-bottom: 1px solid #efefef;
        flex-direction: initial;
        margin: 0 !important;
    }
    .table-row .list-inner{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        text-align: center;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-flex-direction: column;
        flex-direction: column;
    }
    .saler>div{
        width:130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .table-row .list-inner.ops,  .table-row .list-inner.paystyle{
        -webkit-flex-direction: column;
        flex-direction: column;
       -webkit-justify-content: center;
       justify-content: center;
    }
    .table-header .others{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        text-align: center;
    }
    .table-footer{
        border-top: 1px solid #efefef;
    }
    .table-footer>div, .table-top>div{
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        height:100%;
    }
    .fixed-header div{
        padding:0;
    }
    .fixed-header.table-header{
        display: none;
    }
    .fixed-header.table-header.active{
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
    }
    .shop{
        display: inline-block;
        width:48px;
        height:18px;
        text-align: center;
        border:1px solid #1b86ff;
        color: #1b86ff;
        margin-right: 10px;
    }
    .min_program{
        display: inline-block;
        width:48px;
        height:18px;
        text-align: center;
        border:1px solid #ff5555;
        color: #ff5555;
        margin-right: 10px;
    }
    .columnFlex{
        display: flex;
        flex-direction: column;
    }
    .columnFlex .noRefund{
        flex:1;
        width:100%;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        /*border-bottom: 1px solid #efefef;*/
        padding: 16px 10px;
        align-items: center;
    }
    .goodsRefund{
        height:103px;
        display: flex;
        width:100%;
        position: relative;
        flex-direction: column;
        justify-content: center;
        border-bottom: 1px solid #efefef;
        padding: 16px 10px;
        align-items: center;
    }
    .table-row .list-inner.goodsRefund{
        flex: inherit;
    }
</style>

<div class="page-header">
    当前位置：<span class="text-primary">订单管理</span>
    <span>订单数:  <span class='text-danger'>{$total}</span> 订单金额:  <span class='text-danger'>{php echo empty($totalmoney) ? 0.00 : $totalmoney}</span> {if !empty($magent['nickname'])}订单推广人:  <span class='text-danger'>{$magent['nickname']}</span>{/if}</span>
</div>
<div class="page-content">

    <div class="fixed-header table-header" style="padding: 0 50px;">
        <div style='border-left:1px solid #f2f2f2;width: 400px;text-align: left;'>商品</div>
        <div class="others">买家</div>
        <div class="others">支付/配送</div>
        <div class="others">价格</div>
        <div class="others">操作</div>
        <div class="others">状态</div>
    </div>
    <form action="./index.php" method="get" class="form-horizontal table-search" role="form"  id="search">
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="ewei_shopv2" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r" value="order.list{$st}" />
        <input type="hidden" name="status" value="{$status}" />
        <input type="hidden" name="agentid" value="{$_GPC['agentid']}" />
        <input type="hidden" name="refund" value="{$_GPC['refund']}" />
        <input type="hidden" name="headsid" value="{$_GPC['headsid']}" />
        <div class="page-toolbar">
            <div class="input-group">
                <span class="input-group-select">
                    <select name="paytype" class="form-control" style="width:100px;padding:0 5px;">
                        <option value="" {if $_GPC['paytype']==''}selected{/if}>支付方式</option>
                        {loop $paytype $key $type}
                        <option value="{$key}" {if $_GPC['paytype'] == "$key"} selected="selected" {/if}>{$type['name']}</option>
                        {/loop}
                    </select>
                </span>
                <span class="input-group-select">
                    <select name='searchtime'  class='form-control'   style="width:100px;padding:0 5px;"  id="searchtime">
                        <option value=''>不按时间</option>
                        <option value='create' {if $_GPC['searchtime']=='create'}selected{/if}>下单时间</option>
                        <option value='pay' {if $_GPC['searchtime']=='pay'}selected{/if}>付款时间</option>
                        <option value='send' {if $_GPC['searchtime']=='send'}selected{/if}>发货时间</option>
                        <option value='finish' {if $_GPC['searchtime']=='finish'}selected{/if}>完成时间</option>
                    </select>
                </span>
                <span class="input-group-btn">
                    {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                </span>
                <span class="input-group-select">
                    <select name='searchfield'  class='form-control'   style="width:110px;padding:0 5px;"  >
                        <option value='ordersn' {if $_GPC['searchfield']=='ordersn'}selected{/if}>订单号</option>
                        <option value='member' {if $_GPC['searchfield']=='member'}selected{/if}>会员信息</option>
                        <option value='address' {if $_GPC['searchfield']=='address'}selected{/if}>收件人信息</option>
                        <option value='location' {if $_GPC['searchfield']=='location'}selected{/if}>地址信息</option>
                        <option value='expresssn' {if $_GPC['searchfield']=='expresssn'}selected{/if}>快递单号</option>
                        <option value='goodstitle' {if $_GPC['searchfield']=='goodstitle'}selected{/if}>商品名称</option>
                        <option value='goodssn' {if $_GPC['searchfield']=='goodssn'}selected{/if}>商品编码</option>
                        <option value='saler' {if $_GPC['searchfield']=='saler'}selected{/if}>核销员</option>
                        <option value='store' {if $_GPC['searchfield']=='store'}selected{/if}>核销门店</option>
                        <option value='selfget' {if $_GPC['searchfield']=='selfget'}selected{/if}>自提门店</option>
                        <option value='mid' {if $_GPC['searchfield']=='mid'}selected{/if}>用户id</option>
                        {if $merch_plugin}
                        <option value='merch' {if $_GPC['searchfield']=='merch'}selected{/if}>商户名称</option>
                            {/if}
                    </select>
                </span>
                <input type="text" class="form-control input-sm"  name="keyword" id="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                <input type="hidden" name="export" id="export" value="0">
                <span class="input-group-btn">
                        <button type="button" data-export="0" class="btn btn-primary btn-submit"> 搜索</button>
                        <button type="button" data-export="1" class="btn btn-success btn-submit">导出</button>
                        <button type="button"  class="btn btn-default myExport">采购导出</button>
                </span>
            </div>

        </div>

    </form>


    {if count($list)>0}
    <div class="row">
        <div class="col-md-12">
            <div  class="">
                <div class="table-header" style='background:#f8f8f8;height: 35px;line-height: 35px;padding: 0 20px'>
                    <div style='border-left:1px solid #f2f2f2;width: 400px;text-align: left;'>商品</div>
                    <div class="others">买家</div>
                    <div class="others">支付/配送</div>
                    <div class="others">价格</div>
                    <div class="others">操作</div>
                    <div class="others">状态</div>
                </div>
            {loop $list $item}
            <div class="table-row"><div style='height:20px;padding:0;border-top:none;'>&nbsp;</div></div>
                <div class="tables">
                    <div class='table-row table-top' style="padding:0  20px;background: #f7f7f7">
                        <div style="text-align: left;color: #8f8e8e;">
                            <span style="font-weight: bold;margin-right: 10px;color: #2d2d31">

                                {if $item['iswxappcreate']==0}<span class="shop">商城</span>{else}<span class="min_program">小程序</span>{/if}
                                {if $item['giftSign']==1}<span class="min_program" style=" border:1px solid orange; color: orange;">赠品</span>{/if}
                                {if $item['is_cashier'] == 1}<span class="shop">收银台</span>{/if}{php echo date('Y-m-d',$item['createtime'])}&nbsp {php echo date('H:i:s',$item['createtime'])}

                            </span>
                            订单编号:  {$item['ordersn']}{if $item['ispackage']}&nbsp;<span class="label label-success">套餐</span>{/if}
                            {if !empty($item['refundstate']) && $item['refundstate'] !=3}<label class='label label-danger'>{$r_type[$item['rtype']]}申请</label>{/if}
                            {if !empty($item['refundstate']) && $item['refundstate'] !=3 && $item['rstatus'] == 4}<label class='label label-default'>客户退回物品</label>{/if}
                        </div>
                        <div style='text-align:right;font-size:12px;' class='aops'>
                            {if $item['merchid'] == 0}
                                {ifp 'order.op.remarksaler'}
                                <a class='op'  data-toggle="ajaxModal" href="{php echo webUrl('order/op/remarksaler', array('id' => $item['id']))}" >
                                    {if !empty($item['remarksaler'])}
                                    <i class="icow icow-flag-o" style="color: #df5254;display: inline-block;vertical-align: middle" title="  查看备注"></i>
                                    备注
                                    &nbsp
                                    {else}
                                    <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="  添加备注" ></i>
                                    备注
                                    &nbsp
                                    {/if}
                                </a>
                                {/if}
                            {/if}
                            {if $item['merchid'] == 0}
                                {if ($item['statusvalue']>=2 || $item['sendtype']>0) && !empty($item['addressid']) && $item['statusvalue']!=3 &&$item['city_express_state']==0}
                                    {ifp 'order.op.send'}
                                    <a class="op" data-toggle="ajaxModal"  href="{php echo webUrl('order/op/changeexpress', array('id' => $item['id']))}">
                                        <i class="icow icow-wuliu" title="修改物流" style="color: #999;display: inline-block;vertical-align: middle"></i>
                                        修改物流
                                        &nbsp
                                    </a>
                                    {/if}
                                {/if}
                            {/if}
                            {if $item['merchid'] == 0}
                                {if empty($item['statusvalue'])}
                                    {ifp 'order.op.changeprice'}
                                        {if $item['ispackage'] ==0}
                                        <a class='op'  data-toggle='ajaxModal' href="{php echo webUrl('order/op/changeprice',array('id'=>$item['id']))}">
                                            <i class="icow icow-gaijia" title="订单改价"  style="color: #999;display: inline-block;vertical-align: middle"></i>
                                            订单改价
                                            &nbsp
                                        </a>
                                        {/if}
                                    {/if}
                            {if $item['ismerch'] == 0}
                                {ifp 'order.op.close'}
                                <a class='op'  data-toggle='ajaxModal' href="{php echo webUrl('order/op/close',array('id'=>$item['id']))}" >
                                    <i class="icow icow-shutDown" title="关闭订单"  style="color: #999;margin-right: 3px;display: inline-block;vertical-align: middle"></i>
                                    关闭订单
                                    &nbsp
                                </a>

                                {/if}
                            {/if}
                                {/if}
                            {/if}

                            <!--<a class='op'   href="{php echo webUrl('order', array('op' => 'detail', 'id' => $item['id']))}" >标记</a>-->
                        </div>
                    </div>
                    <div class='table-row' style="margin:0  20px">
                        <!----------------singleRefund----------------->
                        <div class="goods-des singleRefund" style='width:400px;text-align: left'>
                            {loop $item['goods'] $k $g}
                            <div class="{if $g['single_refundstate']>0}goodsRefund{/if}"  style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;margin: 10px 0">
                                <img src="{php echo tomedia($g['thumb'])}" style='width:70px;height:70px;border:1px solid #efefef; padding:1px;'onerror="this.src='../addons/ewei_shopv2/static/images/nopic.png'">
                                <div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;margin-left: 10px;text-align: left;display: flex;align-items: center">
                                    <div >
                                       <div class="title">
                                           {if $g['ispresell']==1}
                                           <label class="fui-tag fui-tag-danger">预</label>
                                           {/if}
                                           {$g['title']}<br/>
                                           <span style="color: #999"> {if !empty($g['optiontitle'])}{$g['optiontitle']}{/if}{$g['goodssn']}</span>

                                       </div>
                                              {if $g['seckill_task']}
                                        <div>
                                                <span class="label label-danger">{$g['seckill_task']['tag']}</span>
                                                {if $g['seckill_room']}
                                                    <span class="label label-primary">
                                                        {php echo $g['seckill_room']['tag']?:$g['seckill_room']['title']}
                                                    </span>
                                                {/if}
                                        </div>
                                           {/if}


                                    </div>
                                    <span style="float: right;text-align: right;display: inline-block;width:130px;">
                                        ￥{php echo number_format($g['oldprice']/$g['total'],2)}<br/>
                                        x{$g['total']}<br/>
                                        {if $g['single_refundstate']==8}
                                            <span class="text-danger">已拒绝</span>
                                        {elseif $g['single_refundstate']==9}
                                            <span class="text-danger">维权成功</span>
                                        {elseif $g['single_refundstate']==1}
                                            <span class="text-danger">退款中</span>
                                        {elseif $g['single_refundstate']==2}
                                            <span class="text-danger">退货中</span>
                                        {/if}
                                    </span>
                                </div>
                            </div>
                            {/loop}
                        </div>

                        <div class="list-inner saler columnFlex"   style='text-align: center;' >
                            <div class="">
                                {ifp 'member.list.edit'}
                                <a href="{php echo webUrl('member/list/detail',array('id'=>$item['mid']))}"> {$item['nickname']}</a>
                                {else}
                                {$item['nickname']}
                                {/if}
                                {$item['addressdata']['realname']}<br/>{$item['addressdata']['mobile']}
                            </div>
                        </div>
                        <div class="list-inner paystyle columnFlex"  style='text-align:center;' >
                            <div class="">
                                <!-- 已支付 -->
                                {if $item['statusvalue'] > 0}
                                {if $item['paytypevalue']==1}
                                <span> <i class="icow icow-yue text-warning" style="font-size: 17px;"></i><span>余额支付</span></span>
                                {elseif $item['paytypevalue']==11}
                                <span> <i class="icow icow-kuajingzhifuiconfukuan text-danger" style="font-size: 17px"></i>后台付款</span>
                                {elseif $item['paytypevalue']==21}
                                <span> <i class="icow icow-weixinzhifu text-success" style="font-size: 17px"></i>微信支付</span>
                                {elseif $item['paytypevalue']==22}
                                <span><i class="icow icow-zhifubaozhifu text-primary" style="font-size: 17px"></i>支付宝支付</span>
                                {/if}
                                {else if $item['statusvalue'] == 0}
                                <!-- 未支付 -->
                                {if $item['paytypevalue']!=3}
                                <label class='label label-default'>未支付</label>
                                {else}
                                <span> <i class="text-primary icow icow-icon" style="font-size: 17px"></i>货到付款</span>
                                {/if}
                                {else if $item['statusvalue'] == -1}
                                {if $item['paytypevalue']==1}
                                <span> <i class="icow icow-yue text-warning" style="font-size: 17px;display:inline-block;height: 17px;width: 17px;padding-top: 3px"></i><span>余额支付</span></span>
                                {elseif $item['paytypevalue']==11}
                                <span> <i class="icow icow-kuajingzhifuiconfukuan text-danger" style="font-size: 17px"></i>后台付款</span>
                                {elseif $item['paytypevalue']==21}
                                <span> <i class="icow icow-weixin text-success" style="font-size: 17px"></i>微信支付</span>
                                {elseif $item['paytypevalue']==22}
                                <span><i class="icow icow-zhifubao text-primary" style="font-size: 17px"></i>支付宝支付</span>
                                {/if}
                                {/if}

                                {if $item['paytypevalue'] == 3 && $item['is_cashier'] == 1}
                                <span style='margin-top:5px;display:block;'>收银台现金收款</span>
                                {else}
                                <span style='margin-top:5px;display:block;'>{$item['dispatchname']}</span>
                                {/if}
                            </div>
                        </div>
                        <div class="columnFlex" style="flex: 1;">
                            <div  class="list-inner" data-toggle='popover' data-html='true' data-placement='right' data-trigger="hover"
                                data-content="<table style='width:100%;'>
                                    <tr>
                                        <td  style='border:none;text-align:right;'>商品小计：</td>
                                        <td  style='border:none;text-align:right;;'>￥{php echo number_format( $item['goodsprice'] ,2)}</td>
                                    </tr>
                                    <tr>
                                        <td  style='border:none;text-align:right;'>运费：</td>
                                        <td  style='border:none;text-align:right;;'>￥{php echo number_format( $item['olddispatchprice'],2)}</td>
                                    </tr>
                                    {if $item['taskdiscountprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>任务活动优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['taskdiscountprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['lotterydiscountprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>游戏活动优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['lotterydiscountprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['discountprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>会员折扣：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['discountprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['deductprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>积分抵扣：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['deductprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['deductcredit2']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>余额抵扣：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['deductcredit2'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['deductenough']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>商城满额立减：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['deductenough'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['merchdeductenough']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>商户满额立减：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['merchdeductenough'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['couponprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>优惠券优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['couponprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['isdiscountprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>促销优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['isdiscountprice'],2)}</td>
                                    </tr>
                                    {/if}
                                    {if $item['buyagainprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>重复购买优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['buyagainprice'],2)}</td>
                                    </tr>
                                    {/if}
                                      {if $item['seckilldiscountprice']>0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>秒杀优惠：</td>
                                        <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $item['seckilldiscountprice'],2)}</td>
                                    </tr>
                                    {/if}

                                    {if intval($item['changeprice'])!=0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>卖家改价：</td>
                                        <td  style='border:none;text-align:right;;'><span style='{if 0<$item['changeprice']}color:green{else}color:red{/if}'>{if 0<$item['changeprice']}+{else}-{/if}￥{php echo number_format(abs($item['changeprice']),2)}</span></td>
                                    </tr>
                                    {/if}
                                    {if intval($item['changedispatchprice'])!=0}
                                    <tr>
                                        <td  style='border:none;text-align:right;'>卖家改运费：</td>
                                        <td  style='border:none;text-align:right;;'><span style='{if 0<$item['changedispatchprice']}color:green{else}color:red{/if}'>{if 0<$item['changedispatchprice']}+{else}-{/if}￥{php echo abs($item['changedispatchprice'])}</span></td>
                                    </tr>
                                    {/if}
                                    <tr>
                                        <td style='border:none;text-align:right;'>应收款：</td>
                                        <td  style=`'border:none;text-align:right;color:green;'>￥{php echo number_format($item['price'],2)}</td>
                                    </tr>

                                </table>
                    "> <div style='text-align:center'>
                                ￥{php echo number_format($item['price'],2)}
                                {if $item['dispatchprice']>0}
                                <br/>(含运费:￥{php echo number_format( $item['dispatchprice'],2)})
                                {/if}
                            </div>
                            </div>
                        </div>


                        <!----------------------columnFlex---------------------------------------------->
                        <div  class="list-inner columnFlex" style='text-align:center'>

                            {if $item['refundstate']==3}
                                {loop $item['goods'] $k $g}
                                    {if  $g['single_refundstate']>0}
                                    <div class="{if $g['single_refundstate']>0}goodsRefund{else}noRefund{/if}">
                                        <a class='op text-primary'  href="{php echo webUrl('order/detail', array('id' => $item['id']))}" >查看详情</a>
                                        {ifp 'order.op.refund'}
                                            {if !empty($g['single_refundid'])}
                                                <a class='op  text-primary'  href="{php echo webUrl('order/op/single_refund', array('id' => $g['ogid']))}" >维权{if $item['refundstate']!=9}处理{else}详情{/if}</a>
                                            {/if}
                                        {/if}
                                        {if $item['addressid']!=0 && $item['statusvalue']>=2 && $item['sendtype']==0 && $item['city_express_state']==0}
                                            <a class='op  text-primary'  data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn'],'mobile'=>$item['addressdata']['mobile']))}">物流信息</a>
                                        {/if}

                                        {if $item['city_express_state']==1}
                                            <a class='op  text-primary' href="javascript:tip.msgbox.err('同城配送暂不支持物流信息查询');">物流信息</a>
                                        {/if}
                                        {if $item['invoicename'] && $item['sta']>0}
                                            {php $invoice_info = m('sale')->parseInvoiceInfo($item['invoicename']);}
                                            {if $invoice_info['title'] && $invoice_info['entity'] === false}
                                                <a class='{if $item['invoice_img']}text-success{else}text-danger{/if}' data-toggle="ajaxModal"href="{php echo webUrl('order.op.upload_invoice',array('order_id'=>$item['id']));}">
                                                {if $item['invoice_img']}查看发票{else}上传发票{/if}</a>
                                            {/if}
                                        {/if}
                                    </div>
                                    {/if}

                                    {if $k+1==count($item['goods']) && $g['single_refundstate']==0}
                                        <div class="{if $g['single_refundstate']>0}goodsRefund{else}noRefund{/if}">
                                            <a class='op text-primary'  href="{php echo webUrl('order/detail', array('id' => $item['id']))}" >查看详情</a>
                                                {if $item['addressid']!=0 && $item['statusvalue']>=2 && $item['sendtype']==0 && $item['city_express_state']==0}
                                                    <a class='op  text-primary'  data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn'],'mobile'=>$item['addressdata']['mobile']))}">物流信息</a>
                                                {/if}

                                                {if $item['city_express_state']==1}
                                                    <a class='op  text-primary' href="javascript:tip.msgbox.err('同城配送暂不支持物流信息查询');">物流信息</a>
                                                {/if}
                                                {if $item['invoicename'] && $item['sta']>0}
                                                    {php $invoice_info = m('sale')->parseInvoiceInfo($item['invoicename']);}
                                                    {if $invoice_info['title'] && $invoice_info['entity'] === false}
                                                        <a class='{if $item['invoice_img']}text-success{else}text-danger{/if}' data-toggle="ajaxModal"href="{php echo webUrl('order.op.upload_invoice',array('order_id'=>$item['id']));}">
                                                        {if $item['invoice_img']}查看发票{else}上传发票{/if}</a>
                                                    {/if}
                                                {/if}
                                        </div>
                                    {/if}
                                {/loop}
                            {else}
                                <div class="noRefund">
                                    <a class='op text-primary'  href="{php echo webUrl('order/detail', array('id' => $item['id']))}" >查看详情</a>
                                    {ifp 'order.op.refund'}
                                        {if !empty($item['refundid'])}
                                        <a class='op text-primary' style="line-height: 30px;"  href="{php echo webUrl('order/op/refund', array('id' => $item['id']))}" >维权{if $item['refundstate']>0}处理{else}详情{/if}</a>
                                        {/if}
                                    {/if}
                                    {if $item['addressid']!=0 && $item['statusvalue']>=2 && $item['sendtype']==0 && $item['city_express_state']==0}
                                        <a class='op  text-primary'  data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$item['express'],'expresssn'=>$item['expresssn'],'mobile'=>$item['addressdata']['mobile']))}">物流信息</a>
                                    {/if}

                                    {if $item['city_express_state']==1}
                                        <a class='op  text-primary' href="javascript:tip.msgbox.err('同城配送暂不支持物流信息查询');">物流信息</a>
                                    {/if}
                                    {if $item['invoicename'] && $item['status_id']>0}
                                        {php $invoice_info = m('sale')->parseInvoiceInfo($item['invoicename']);}
                                        {if $invoice_info['title'] && $invoice_info['entity'] === false}
                                            <a class='{if $item['invoice_img']}text-success{else}text-danger{/if}' data-toggle="ajaxModal"href="{php echo webUrl('order.op.upload_invoice',array('order_id'=>$item['id']));}">
                                            {if $item['invoice_img']}查看发票{else}上传发票{/if}</a>
                                        {/if}
                                    {/if}
                                </div>
                            {/if}
                        </div>

                        <div  class='ops list-inner columnFlex' style='line-height:20px;text-align:center' >
                           <div class="">
                               <span class='text-{$item['statuscss']}'>{$item['status']}</span>
                               {if $item['merchid'] == 0}{template 'order/ops'}{/if}
                           </div>
                        </div>
                    </div>
            {if !empty($item['remark'])}
            <div class="table-row"><div  style='background:#fdeeee;color:red;flex: 1;;'>买家备注: {$item['remark']}</div></div>
            {/if}

            {if (!empty($level)&&!empty($item['agentid'])) || (!empty($item['merchname']) && $item['merchid'] > 0)}
            <div class="table-footer table-row" style="margin:0 20px">
                <div  style='text-align:left'>
                    {if !empty($item['merchname']) && $item['merchid'] > 0}
                    商户名称：<span class="text-info">{$item['merchname']}</span>
                    {/if}
                    {if !empty($agentid)}
                    <b>分销订单级别:</b> {$item['level']}级 <b>分销佣金:</b> {$item['commission']} 元
                    {/if}
                </div>
                <div  style='text-align:right'>
                    {if empty($agentid)}
                    {if $item['commission1']!=-1}<b>1级佣金:</b> {$item['commission1']} 元 {/if}
                    {if $item['commission2']!=-1}<b>2级佣金:</b> {$item['commission2']} 元 {/if}
                    {if $item['commission3']!=-1}<b>3级佣金:</b> {$item['commission3']} 元 {/if}
                    {/if}

                    {if !empty($item['agentid']) && !$is_merch[$item['id']]}
                    {ifp 'commission.apply.changecommission'}
                    <a class="text-primary" data-toggle="ajaxModal"  href="{php echo webUrl('commission/apply/changecommission', array('id' => $item['id']))}">修改佣金</a>
                    {/if}
                    {/if}
                </div>
            </div>
            {/if}
            </div>
            {/loop}
                <div style="padding: 20px;text-align: right" >
                        {$pager}
                </div>
            </div>
        </div>
    </div>
    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">暂时没有任何订单!</div>
    </div>
    {/if}
</div>

<script>
    //没有选中时间段不能导出
    $(function () {
        $('.btn-submit').click(function () {
            var e = $(this).data('export');
            if(e==1 ){
                if($('#keyword').val() !='' ){
                    $('#export').val(1);
                    $('#search').submit();
                }else if($('#searchtime').val()!=''){
                    $('#export').val(1);
                    $('#search').submit();
                }else{
                    tip.msgbox.err('请选择按时间导出!');
                    return;
                }
            }else{
                $('#export').val(0);
                $('#search').submit();
            }
        })
    })
</script>
<script>

        $('.myExport').click(function () {
                    var time=$('.daterange-time >span').text();
                    var searchtime=$("#searchtime").val();

                    if(!searchtime){
                       tip.msgbox.err('请选择按时间导出!');
                       return;
                    }
                    $.ajax({
                        url:'myexport.php',
                        type:'POST',
                        dataType:'text',
                        data:{
                            time:time,
                            searchtime:searchtime,
                        },
                        success:function(data){
                            window.location.href='https://fx2016.qiwewang.com/web'+data;
                        },
                    });
                });
</script>
{template '_footer'}
